<template> 
  <el-config-provider :locale="locale">
    <Header v-if="!hideHeader"></Header>
    <SideMenu :memuList="memuList" v-if="logged"></SideMenu>
    <RouterView class="router_container" />
  </el-config-provider>
</template>

<script setup lang="ts">
import { Header, SideMenu } from '@/components/common' 
import { RouteLocationNormalized, RouterView }  from 'vue-router'  
import { fetch }  from '@/utils/request'
import {storeToRefs} from 'pinia'

 import { ElConfigProvider } from 'element-plus'
import zhCn from 'element-plus/lib/locale/lang/zh-cn'

import { commonStroe } from '@/stores/common'
import { ref, watch } from 'vue'
import router from './router' 
const skin = 'white'
const hideHeader =  ref(false) 
const stroe = commonStroe()
const {logged, memuList} = storeToRefs(stroe) 
window.document.documentElement.setAttribute("theme", skin) 
router.beforeEach((to: RouteLocationNormalized) => { 
   hideHeader.value = to.meta.hideHeader  
})
let locale = zhCn
 
if(logged) {
  stroe.requestMenuList()
}

watch(logged, (newValue) => {  
  if(newValue) {
    stroe.requestMenuList()
  } 
}) 
</script> 

 